<nav class="navbar navbar-expand-lg navbar-light bg-light">
    <div class="container">
        <a class="navbar-brand" href="{{ url_for('main.index') }}">Will's Blog</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
                aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav me-auto">
                <li class="nav-item">
                    <a class="nav-link {% if request.endpoint == 'main.index' %}active{% endif %}" 
                       href="{{ url_for('main.index') }}">首页</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link {% if request.endpoint == 'music.index' %}active{% endif %}"
                       href="{{ url_for('music.index') }}">音乐</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link {% if request.endpoint == 'game.index' %}active{% endif %}"
                       href="{{ url_for('game.index') }}">游戏</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link {% if request.endpoint == 'main.about' %}active{% endif %}"
                       href="{{ url_for('main.about') }}">关于</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link {% if request.endpoint == 'main.contact' %}active{% endif %}" 
                       href="{{ url_for('main.contact') }}">联系</a>
                </li>
            </ul>
            <ul class="navbar-nav">
                {% if current_user.is_authenticated %}
                    {% if current_user.is_admin %}
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('admin.index') }}">管理后台</a>
                    </li>
                    {% endif %}
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
                           data-bs-toggle="dropdown" aria-expanded="false">
                            {{ current_user.username }}
                        </a>
                        <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
                            <li><a class="dropdown-item" href="{{ url_for('auth.profile') }}">个人资料</a></li>
                            <li><a class="dropdown-item" href="{{ url_for('auth.change_password') }}">修改密码</a></li>
                            <li>
                                <hr class="dropdown-divider">
                            </li>
                            <li><a class="dropdown-item" href="{{ url_for('auth.logout') }}">退出登录</a></li>
                        </ul>
                    </li>
                {% else %}
                    <li class="nav-item">
                        <a class="nav-link {% if request.endpoint == 'auth.login' %}active{% endif %}" 
                           href="{{ url_for('auth.login') }}">登录</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link {% if request.endpoint == 'auth.register' %}active{% endif %}" 
                           href="{{ url_for('auth.register') }}">注册</a>
                    </li>
                {% endif %}
            </ul>
        </div>
    </div>
</nav>